<?php
require(LIBPATH.'core/AbsModel'.EXT);
class FX_Model extends AbsModel {

	/**
	 * Constructor
	 *
	 * Calls the initialize() function
	 */
	function __construct()
	{	
		parent::__construct();
	}

	/**
    	   * 로그 기록 메소드..
     *	@param mixed	
     *	@param string	
     *	@param array	
     */
    public function log($ref_key='', $memo='', $data=array())
    {
    	if(count($data) == 0)	$data = self::r('*', $this->primary." = '{$ref_key}'");
		if($data && $ref_key)
		{
			$ci = & get_instance();
			$tmp_table = $this->table; 
			$this->table = "log";
	    	$log = array(	'user_seq'		=>	$ci->user_seq,
							'log_table'		=>	$tmp_table,
							'log_table_seq'	=>	$ref_key,
							'log_memo'		=>	$memo,
							'log_json'		=>	json_encode($data),
							'log_time'		=>	'UNIX_TIMESTAMP()',
							'log_ip'		=>	$this->ipAddr()
							);
	    	self::i($log); 
	    	$this->table = $tmp_table;
	    	unset($tmp_table);
		}
    }
}